package cn.edu.seig.textbook.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

import java.security.Key;

/**
 * <p>
 *
 * </p>
 *
 * @author day
 * @since 2024-11-07
 */
@Getter
public enum SexEnum {
    MALE(1,"男"),
    FEMALE(2,"女");
    @EnumValue
    public final Integer sex;
    public final String sexName;
    SexEnum(Integer sex,String sexName){
        this.sex=sex;
        this.sexName=sexName;
    }
    public static SexEnum fromSex(Integer sex) {
        for (SexEnum sexEnum : values()) {
            if (sexEnum.getSex().equals(sex)) {
                return sexEnum;
            }
        }
        throw new IllegalArgumentException("Unexpected value: " + sex);
    }
}
